package com.qianfeng.util;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 2019/12/7
 * Administrator
 * springboot1207
 * 面向对象面向君  不负代码不负卿
 */
@Component
@Aspect//标记当前是切面类
public class LogAop {
    Logger logger = LoggerFactory.getLogger(LogAop.class);
    //切点
    @Pointcut("execution(* com.qianfeng.web.*.*(..))")
    public void abc(){}
    //前置
    @Before("abc()")
    public void qianzhi(){
        logger.info("controller开始执行:"+new Date());
    }


    //后置
    @AfterReturning("abc()")
    public void houzhi(){
        logger.info("controller结束执行:"+new Date());
    }
}
